<?php
    header('Access-Control-Allow-Origin:*');
    //  var_dump($_COOKIE['edit_project_id']);
    $filename = './controller_esf/'.'ETS'.date('Ymd-His').'.esf';
    $file = fopen($filename,'a+');
    $first_line =  "世讯科技NO:".$_POST['id']."工程控件列表";
    // print_r ($first_line);    
    $write = fwrite($file,$first_line."\r\n");
    
    for($i=0;$i<count($_POST['data']);$i++){
            // $row = json_encode($_POST['data'][$i],JSON_UNESCAPED_UNICODE);
            // $write = fwrite($file,$row."\r\n");
        $data = $_POST['data'][$i];
        $row = "新建主群组.新建中箭组.".$data['address']."\t".$data['name']."\t"."EIS 1 'Switching' (".$data['data_type'].")"."\t".$data['priority'];
        $write = fwrite($file,$row."\r\n");
    }
  
    //  fclose($file);
?>
